package com.java.simple.study.jvm.memstruct.directmemory;

import java.io.IOException;
import java.nio.ByteBuffer;

/**
 * @author zhoujunlin
 * @date 2021/12/15
 * @desc -XX:+DisableExplicitGC  禁用代码中的显式FullGC
 **/
public class Demo4_3 {

    static int _1GB = 1024 * 1024 * 1024;

    public static void main(String[] args) throws IOException {
        ByteBuffer byteBuffer = ByteBuffer.allocateDirect(_1GB);
        System.out.println("分配完毕");
        System.in.read();
        System.out.println("开始释放");
        byteBuffer = null;
        System.gc();  // fullGC 造成STW  一般禁用代码显式GC
        System.in.read();
    }

}
